{extend name="layout"}
{block name="style"}
<style>
body{min-width: inherit;background-color: #fff;overflow-x: hidden;}
.teacher{display: none;}
.layui-layout-admin .layui-body{top:10px;}
form{padding:50px 0;}
.layui-footer{width: 100%;position: fixed;bottom: 0;padding:10px 0px;background-color: #eee;text-align: center;}
</style>
{/block}
{block name="header"}{/block}
{block name="menu"}{/block}
{block name="more"}{/block}
{block name="footer"}

{/block}
{block name="main"}
<form class="layui-form" action="" method="post">
    
    
    <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">上级名称</label>
      <div class="layui-input-inline">
        <select name="pid" required lay-verify="required" lay-filter="">
            <option value="0"> 根目录</option>
            {volist name="data" id="vo"}
          <option value="{$vo['id']}" >{$vo['title']}</option>
          {/volist}
        </select>
      </div>
    </div>
  </div>

   
  
  
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">权限名称</label>
      <div class="layui-input-inline">
        <input type="text" name="title" placeholder="" required lay-verify="title" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
    
    <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">控/方</label>
      <div class="layui-input-inline">
        <input type="text" name="name" placeholder="" required lay-verify="name" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
  
  

  
  

  <div class="layui-footer">
    <button class="layui-btn layui-btn-normal layui-btn-small" lay-submit lay-filter="*" type="button">立即提交</button>
    <button class="layui-btn layui-btn-small layui-btn-primary" id="closeFrame" type="button">完成/取消</button>
  </div>

</form>
<script>
  layui.use(['layer','jquery','form','layedit','laydate'],function(){
    var $ = layui.jquery;
    var form = layui.form;
    var layedit = layui.layedit;
    var laydate=layui.laydate;
    

    layedit.set({
    	uploadImage:{
    		url: '{:url('upload/articleImage')}',type:'post'
    	}
    })

    var editIndex = layedit.build('content');

    form.verify({
//      username:function(value){if(value.length < 3){return '账号至少得3个字符啊';}}
//       ,pass: [/(.+){6,12}$/, '密码必须6到12位']
//        ,name: [/^[\u4e00-\u9fa5]{2,5}$/, '姓名必须为2到5个汉字']
        
      
    });
    
    //日期
  laydate.render({
    elem: '#date'
  });
 

    //监听提交
    form.on('submit(*)', function(data){
      data.form.submit();
      return true;
    });
    $('#closeFrame').on('click',function(){
      parent.layer.closeAll();
    })
    $('#addData').on('click',function(){
      $('form').submit();
    })
  });
</script>
{/block}
{block name="script"}
{/block}
 form.verify({
    title: function(value){
      if(value.length < 5){
        return '标题至少得5个字符啊';
      }
    }
    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });